package com.kvest.ula.core;

import java.util.HashMap;
import java.util.Map;

public class RuntimeData 
{
	private static RuntimeData instance;
    private static final Object lockObj = new Object();
    
    private Map<Integer, Long> updateTime;
    
    public static RuntimeData getInstance()
    {
        synchronized(lockObj)
        {
            if (instance == null)
            {
                instance = new RuntimeData();
            }
        }

        return instance;
    }

    private RuntimeData()
    {
        updateTime = new HashMap<Integer, Long>();
    }
    
    public void setUpdateTime(Integer id, Long updateTime)
    {
        this.updateTime.put(id, updateTime);
    }

    public long getUpdateTime(Integer id)
    {
        if (updateTime.containsKey(id))
        {
            return ((Long)updateTime.get(id)).longValue();
        }
        else
        {
            return 0;
        }
    }
}
